<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'tce.label', default: 'Tce')}" />
        <title><g:message code="default.show.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="body">
            <div class="cabelistlateral"><img src="${resource(dir:'images',file:'seta_cabecalho_20x20.png')}" /> Visualização TCE</div><br/>
            <div class="dialog dadospessoais">
                <g:if test="${flash.message}">
                    <div class="message">${flash.message}</div>
                </g:if>
                <table>
                    <tbody>
                        <%
                        String situacao;
                        String style;
                        if(tceInstance?.situacao == '0'){
                            situacao = "Aguardando";
                            style    = " style='color:#ff0000; font-weight:bold;'";
                        }else if(tceInstance?.situacao == '1'){
                            situacao = "Gerado";
                            style    = " style='color:#006600; font-weight:bold;'";
                        }else{
                            situacao = "Recindido";
                            style    = " style='color:#f78b00; font-weight:bold;'";
                        }
                        %>
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.situacao.label" default="Situação" /></td>
                            <td${style}>${situacao}</td>
                        </tr>

                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.sequencia.label" default="Sequencia" /></td>
                            <td class="value">${fieldValue(bean: tceInstance, field: "sequencia")}</td>
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.dtInicio.label" default="Data Início" /></td>
                            <td class="value"><g:formatDate date="${tceInstance?.dtInicio}" /></td>
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.dtFim.label" default="Data Fim" /></td>
                            <td class="value"><g:formatDate date="${tceInstance?.dtFim}" /></td>
                        </tr>

                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.instituicaoEnsino.label" default="Instituição Ensino" /></td>
                            <td class="value">${tceInstance?.instituicaoEnsino?.nome}</td>
                        </tr>

                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.curso.label" default="Curso" /></td>
                            <td class="value">${tceInstance?.curso?.descricao}</td>
                        </tr>

                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.supNome.label" default="Nome Supervisor" /></td>
                            <td class="value">${fieldValue(bean: tceInstance, field: "supNome")}</td>
                        </tr>

                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.supCpf.label" default="CPF Supervisor" /></td>
                            <td class="value">${fieldValue(bean: tceInstance, field: "supCpf")}</td>
                        </tr>

                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.atividades.label" default="Atividades" /></td>
                            <td class="value">${fieldValue(bean: tceInstance, field: "atividades")}</td>
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.chSemanal.label" default="Carga Horária Semanal" /></td>
                            <td class="value">${fieldValue(bean: tceInstance, field: "chSemanal")}</td>
                        </tr>

                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.seguradora.label" default="Seguradora" /></td>
                            <td class="value">${fieldValue(bean: tceInstance, field: "seguradora")}</td>
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.nroApolice.label" default="Nº Apolice" /></td>
                            <td class="value">${fieldValue(bean: tceInstance, field: "nroApolice")}</td>
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.remunera.label" default="Remuneração" /></td>
                            <td class="value">${fieldValue(bean: tceInstance, field: "remunera")}</td>
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.dtRescisao.label" default="Data Rescisao" /></td>
                            <td class="value"><g:formatDate date="${tceInstance?.dtRescisao}" /></td>
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.rescCausa.label" default="Causa Recisão" /></td>
                            <td class="value">${fieldValue(bean: tceInstance, field: "rescCausa")}</td>
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="tce.obsCausa.label" default="Obs Causa" /></td>
                            <td class="value">${fieldValue(bean: tceInstance, field: "obsCausa")}</td>
                        </tr>

                        <tr>
                          <td></td>
                          <td class="btsalvarcadastro">
                              <form method="post" action="${createLink(controller:'tce', action:'edit', id:tceInstance?.id)}">
                                  <g:actionSubmit class="edit" action="edit" value="${message(code: 'default.button.edit.label', default: 'Edit')}" />
                              </form>
                          </td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <div class="dadoslateral">
                <h1 class="cabelistlateral">Remuneração</h1>
                <%
                if(tceRemuneraInstanceList){
                    %>
                    <div class="list">
                        <table>
                            <thead>
                                <tr>
                                    <g:sortableColumn property="dtInicio" title="${message(code: 'tceRemunera.dtInicio.label', default: 'Dt Inicio')}" />
                                    <g:sortableColumn property="remuneracao" title="${message(code: 'tceRemunera.remuneracao.label', default: 'Remuneracao')}" />
                                </tr>
                            </thead>
                            <tbody>
                            <g:each in="${tceRemuneraInstanceList}" status="i" var="tceRemuneraInstance">
                                <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                                    <td><g:formatDate date="${tceRemuneraInstance.dtInicio}" /></td>
                                    <td>${fieldValue(bean: tceRemuneraInstance, field: "remuneracao")}</td>
                                </tr>
                            </g:each>
                            </tbody>
                        </table>
                    </div>
                    <%
                }else{
                    %>
                    <div class="list">Nenhuma remuneração encontrada.</div>
                    <%
                }
                %>
            </div>

            <div class="dadoslateral">
                <h1 class="cabelistlateral">Pagamento</h1>
                <%
                if(tcePagamentoInstanceList){
                    %>
                    <div class="list">
                        <table>
                            <thead>
                                <tr>
                                    <g:sortableColumn property="dtPagamento" title="${message(code: 'tcePagamento.dtPagamento.label', default: 'Data Pagamento')}" />
                                    <g:sortableColumn property="valor" title="${message(code: 'tcePagamento.valor.label', default: 'Valor')}" />
                                    <th><g:message code="tcePagamento.formaPagamento.label" default="Forma" /></th>
                                </tr>
                            </thead>
                            <tbody>
                            <g:each in="${tcePagamentoInstanceList}" status="i" var="tcePagamentoInstance">
                                <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                                    <%
                                    def formaPagamento = FormaPagamento.findById(tcePagamentoInstance.formaPagamento.id);
                                    %>
                                    <td><g:formatDate date="${tcePagamentoInstance.dtPagamento}" /></td>
                                    <td>${fieldValue(bean: tcePagamentoInstance, field: "valor")}</td>
                                    <td>${formaPagamento.descricao}</td>
                                </tr>
                            </g:each>
                            </tbody>
                        </table>
                    </div>
                    <%
                }else{
                    %>
                    <div class="list">Nenhuma pagamento encontrado.</div>
                    <%
                }
                %>
            </div>

            <div class="dadoslateral">
              <h1 class="cabelistlateral">Plano de Estágio</h1>
              <%
              if(planoEstagioInstanceList){
                  %>
                  <div>
                      <table>
                          <tbody>
                          <g:each in="${planoEstagioInstanceList}" status="i" var="planoEstagioInstance">
                              <tr>
                                  <td>
                                      <span class="b">${message(code: 'planoEstagio.setores.label', default: 'Setores:')} </span>
                                      ${fieldValue(bean: planoEstagioInstance, field: "setores")}
                                  </td>
                              </tr>
                              <tr>
                                  <td>
                                      <span class="b">${message(code: 'planoEstagio.objetivos.label', default: 'Objetivos:')} </span>
                                      ${fieldValue(bean: planoEstagioInstance, field: "objetivos")}
                                  </td>
                              </tr>
                              <tr>
                                  <td>
                                      <span class="b">${message(code: 'planoEstagio.infoComplementar.label', default: 'Informações Complementares:')} </span>
                                      ${fieldValue(bean: planoEstagioInstance, field: "infoComplementar")}
                                  </td>
                              </tr>
                              <tr>
                                  <td>
                                      <span class="b">${message(code: 'planoEstagio.dtAssinaSuperior.label', default: 'Data Assinatura Superior:')} </span>
                                      ${planoEstagioInstance.dtAssinaSuperior}
                                  </td>
                              </tr>
                              <tr>
                                  <td>
                                      <span class="b">${message(code: 'planoEstagio.dtAssinaEstagiario.label', default: 'Data Assinatura Estagiário:')} </span>
                                      ${planoEstagioInstance.dtAssinaEstagiario}
                                  </td>
                              </tr>
                          </g:each>
                          </tbody>
                      </table>
                  </div>
                  <%
              }else{
                  %>
                  <div class="list">Nenhuma Plano de Estágio encontrado.</div>
                  <%
              }
              %>
            </div>

        </div>
    </body>
</html>
